const http = require('http')
const cluster = require('cluster')
const os = require('os')
const process = require('process')
// console.log(cluster);

if (cluster.isMaster) {
  for (let i = 0; i < os.cpus().length; i++) {
    cluster.fork()
  }
  console.log('主进程');
} else {
  http.createServer((req, res) => {
    console.log(process.pid);
    res.write('aaa')
    res.end()

  }).listen(9999)



  console.log('子进程');
}

